<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
	
<head>
		<meta charset="utf-8">
		<title>登录界面</title>
		<link rel="stylesheet" href="${path}/statics/css/member/login/reset.css" />
		<link rel="stylesheet" href="${path}/statics/css/member/login/common.css" />
		<link rel="stylesheet" href="${path}/statics/layui/css/layui.css">
	
</head>
<body>
		<div class="wrap login_wrap">
			<div class="content">
				<div class="logo"></div>
				<div class="login_box">	
					
					<div class="login_form" style="padding-bottom:30px">
						<div class="login_title">
							登录
						</div>
						<form action="" method="post" id="formId">
							
							<div class="form_text_ipt">
								<input name="mobile" type="text" id="mobileId" value="13222222222" placeholder="手机号">
							</div>
							<div class="ececk_warning"><span>账号不能为空</span></div>
							<div class="form_text_ipt">
								<input name="password" type="password" id="pwdId" value="111" placeholder="密码">
							</div>
							<div class="ececk_warning"><span>密码不能为空</span></div>
							
							<div class="form_btn">
								<button type="button" onclick="javascript:window.location.href='#'" name="commit" value="登录" id="loginBtn">登录</button>
							</div>
							<div class="form_reg_btn">
								<span>还没有帐号？</span><a href="/frontCtl/toRegister">马上注册</a>
							</div>
						</form>
						
					</div>
				</div>
			</div>
		</div>
	
	<script type="text/javascript" src="${path}/statics/js/jquery-1.8.3.js"></script>
	<script src="${path}/statics/layui/layui.js"></script>
	<script type="text/javascript">
		layui.use(['laydate', 'laypage','element','jquery','layer','upload',"table"], function(){
		  var element = layui.element;
		  var $ = layui.jquery;
		  var layer = layui.layer;
		  var upload = layui.upload;
		  var table = layui.table;
		  var laydate = layui.laydate //日期
		  ,laypage = layui.laypage //分页
		  
		  
		  //给登录按钮绑定事件
		  $("#loginBtn").click(function(){
		  	var mobile = $("#mobileId").val();
		  	var pwd = $("#pwdId").val();
		  	
		  	if(mobile.length == 0){
		  		layer.msg("手机号不能为空",{icon:2 , time:1000});
		  	}
			if(pwd.length == 0){
				layer.msg("密码不能为空",{icon:2 , time:1000});
			}
			
			$.post("${path}/frontCtl/login",$("#formId").serialize(),function(res){
				if(res == 0){
					location.replace("${path}/frontCtl/toIndex");
					console.log(${member.id});
					console.log(${member.nickName});
				}else if(res == 1){
					layer.msg("手机号或密码不正确",{icon:5 , time:2000});
				}else if(res == 3){
					layer.msg("您的账号已被管理员停用,无法登录!",{icon:2});
				}else{
					layer.msg("系统繁忙,请稍后!",{icon:5 , time:1000});
				}
			});
		  	
		  })
		  
	
		});
	
	
	
	
	
	</script>	

</body>
</html>
